''' tranforms '''
from torchvision import transforms
import cv2 as cv

from tb import tb

with tb() as writer:
    tensor_img = transforms.ToTensor()(cv.cvtColor(cv.imread("./data/miku.jpg"), cv.COLOR_BGR2RGB))
    writer.add_image('miku', tensor_img, 1)

    # 归一化
    normal_img = transforms.Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5])(tensor_img)
    writer.add_image('miku', normal_img, 2)

    # compose
    transform = transforms.Compose([
        transforms.ToTensor(),
        transforms.Normalize(mean=[0.5, 0.5, 0.5], std=[0.5, 0.5, 0.5])
    ])
    writer.add_image('miku', transform(cv.cvtColor(cv.imread("./data/miku.jpg"), cv.COLOR_BGR2RGB)), 0)
